@extends("admin.layouts.main")
<style>
	.my-ver-align { vertical-align: -2px;}
	.btn-link {color: gray;}
</style>
@section("content")
<div class="container-fiuld p-3">
    <div class="card">
        <div class="card-body">
            <div class="row mt-3 mb-3">
                <div class="col-lg-12">
                    <form class="form-inline">
						<label>公会：</label>
						<select id="guild" class="form-control" naem="guild">
                            <option value="">全部</option>							
							@foreach($guildlist as $v)
                            <option value="{{$v['id']}}" @if($guild == $v['id']) selected @endif>{{$v['username']}}</option>
							@endforeach
                        </select>
                        <label class="ml-3">主播ID/主播昵称:</label>
                        <input type="text" class="ml-4 mr-5 form-control" name="keyword" id="keyword" value="{{$keyword}}" placeholder="请选择">
                        <label for="time">时间周期：</label>
                        <select id="time_value" class="form-control" name="time_value">
                            <option value="">请选择</option>
                            <option value="1" @if($time_value ==1) selected @endif>昨日</option>
                            <option value="2" @if($time_value == 2) selected @endif>本日</option>
                            <option value="3" @if($time_value == 3) selected @endif>一周</option>
                            <option value="4" @if($time_value == 4) selected @endif>本月</option>
                        </select>
						<a class="btn btn-primary ml-1 mr-3 search text-white">查询</a>
                        <button type="reset" class="btn btn-secondary">重置</button>
                    </form>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <table class="table">
                        <thead class="thead-light">
                        <tr class="text-dark">
                            <th>时间</th>
                            <th>主播ID/昵称</th>
                            <th>通话总时长（分钟）</th>
                            <th>通话人数（人）</th>
                            <th>收到的洽贝</th>
							<th>所属公会</th>
                        </tr>
                        </thead>
                        <tbody>
						@foreach($call as $v)
							<tr>
								<td>{{$v['date']}}</td>
								<td>{{$v['to_id'] }}/{{ $v['name'] }}</td>
								<td>{{$v['length']}}</td>
								<td>{{$v['count']}}</td>
								<td>{{$v['sum_amount']}}</td>
								<td>{{$v['title']}}</td>
							</tr>
						@endforeach
                        </tbody>
                    </table>
                </div>
            </div>
		</div>	
		<div style="text-align: right;">
		@if(!empty($call))
		{{ $call->links('admin.layouts.paginate') }}
		@endif;
		</div>
    </div>
</div>
@endsection
@section("js")
<script type="text/javascript">
    layui.use(['form', 'ori', "laydate"], function () {
        var form = layui.form,
            ori = layui.ori,
            dialog = layui.dialog,
            $ = layui.$;
        ori.reset("[type=reset]");
        $('.search').click(function () {
			var guild = $("#guild").val();
            var keyword = $("#keyword").val();
			var time_value = $("#time_value").val();
            location.href = "{{ route('report.call') }}" +'?guild='+guild+'&keyword=' +keyword+'&time_value='+ time_value;
        });
    });
</script>
@endsection
